home *** CD-ROM | disk | FTP | other *** search
- --
- -- launchApp takes a list of filepaths to documents and tries to find an application
- -- that will launch one of the documents. As soon as it finds a good application,
- -- it tries to launch it, displaying an error message if anything goes wrong.
- --
- on launchApp me, browserDocList, description
- -- if the application has already been launched then just bring the app to the front
- if pInstanceID > 0 then
- if pMAObj(mInstanceIsRunning, pInstanceID) then
- set pInstanceID = pMAObj(mLaunch, pAppPath, EMPTY)
- checkForError(me, pInstanceID)
- return pInstanceID
- end if
- end if
-
- repeat with pBrowserDoc in browserDocList
- set pAppPath = pMAObj(mLocateExecutable, pBrowserDoc)
- if word 1 of pAppPath <> "Error:" then exit repeat
- end repeat
-
- if word 1 of pAppPath = "Error:" then
- alert "Sorry, I could not locate a " & description & "."
- else
- if not (the machineType=256) then
- set result = pMAObj(mSetMenuBarHeight, 20)
- end if
-
- set pInstanceID = pMAObj(mLaunch, pAppPath, pBrowserDoc)
-
- if not (the machineType=256) then
- set result = pMAObj(mSetMenuBarHeight, 0)
- end if
-
- checkForError(me, pInstanceID, description)
- end if
-
- Return pInstanceID -- contains an error code (< 0) if launching failed
- end
-
-